<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>角色列表</title>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/bootstrap/css/bootstrap.min.css" media="screen">
	<script src="__PUBLIC__/js/jquery-2.1.4.min.js"></script>
	<script src="__PUBLIC__/admin/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
	<center>
	<div class="panel panel-primary">
		<block name="main">
		<div class="panel-heading">{$title}</div>
			<div class="panel-body">
				<table class="table table-striped table-hover table-condensed table-bordered" width="800" style="color:#999;">		
					<tr>
						<th style='text-align: center;'>ID</th>
						<th style='text-align: center;'>角色名</th>
						<th style='text-align: center;'>说明</th>
						<th style='text-align: center;'>状态</th>
						<th style='text-align: center;'>拥有权限</th>
						<th style='text-align: center;'>操作</th>
					</tr>
					<foreach name = 'list' item = 'val'>
					<tr>

						<th style='text-align: center;'>{$val.id}</th>
						<th style='text-align: center;'>{$val.name}</th>
						<th style='text-align: center;'>{$val.remark}</th>
						<th style='text-align: center;'>
							<if condition="$val.status eq '1'">启用<else />禁用</if>	
						</th>
						<th style='text-align: center;' id="th">
							<a rel="popover" href="#" id="{$val.id}" class="btn btn-success" data-node=<?php echo json_encode($val['node']) ?> >查看权限</a>
						</th>
						<!-- <?php echo "<pre>"; var_dump($val); echo "</pre>";?>	 -->
						<th style='text-align: center;'>
						<a href='{:U("Admin/Adminrole/edit",array('id'=>$val["id"]))}'><button class='btn btn-primary'>修改</button></a>
						<a href='{:U("Admin/Adminrole/del",array('id'=>$val["id"]))}'><button class="btn btn-danger">删除</button></a>
						<a href="{:U('Admin/Adminrole/nodelist',array('id'=>$val['id']))}"><button class="btn btn-info">分配权限</button></a>
						</th>
					</tr>
					</foreach>
				</table>
			</div>
		</div>
		</block>
	</div>
	</center>
</body>
	<script>
		$(function () 
    	{　
    		$('#th .btn').click(function(){

    			// console.log($(this).attr('data-node'));
    			var content = JSON.parse($(this).attr('data-node'));
    				html ='<table>';
    			$.each(content,function(i){
    				html +='<tr><td>'+content[i]+'</td></tr>';
    			})
    				html +='</table>';

    				console.log(content);

    			$("#th .btn").popover({title:'权限列表', content:html,html:true}); 

    		})
    		
    	});
	</script>
</html>